package com.sd.jdbc;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class DatabaseMetadata {

	public static void main(String[] args) throws Exception{
		//registering the driver
			//Class.forName("oracle.jdbc.oracle.OracleDriver");
		DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
			System.out.println("driver registered");
			//Established connection
			Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","tiger");
			System.out.println("connection Established");
			//create prepared statement
			PreparedStatement ps=conn.prepareStatement("insert into Emp1 values(?,?)");
			System.out.println("statement prepared");
			//create object of database meta data
			DatabaseMetaData dmd=conn.getMetaData();
			System.out.println("Db name" + dmd.getDatabaseProductName());
			System.out.println("Db minor version" + dmd.getDatabaseMinorVersion());
			System.out.println("Db major version" + dmd.getDatabaseMajorVersion());
			System.out.println("Db Drive name" + dmd.getDriverName());
			System.out.println("Db URL" + dmd.getURL());

			



			conn.close();
		}
		
		

	}
